//
//  Utils.m
//  新浪微博模拟
//
//  Created by song on 16/1/16.
//  Copyright © 2016年 song. All rights reserved.
//

#import "Utils.h"

@implementation Utils

+(UIImage *)cutImageToIcon:(UIImage *)img
{
    UIGraphicsBeginImageContextWithOptions(img.size ,NO,0);
    CGContextRef ctx  =UIGraphicsGetCurrentContext();
    
    CGContextAddEllipseInRect(ctx, CGRectMake(0, 0, img.size.width, img.size.height));
    
    CGContextClip(ctx);
    
    [img drawInRect:CGRectMake(0, 0, img.size.width, img.size.height)];
    UIImage *newimg = UIGraphicsGetImageFromCurrentImageContext();
    return newimg;
}

@end
